home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.rexx
- Subject: EHLLAPI Download file exa
- From: david.lewis@canrem.com (David Lewis)
- Path: canrem.com!david.lewis
- Distribution: world
- Message-ID: <60.10162.4414.0N20840A@canrem.com>
- Date: Wed, 24 Jan 96 00:53:00 -0500
- Organization: CRS Online (Toronto, Ontario)
-
- Hi Simon.
-
- S> I urgently need an example of downloading a file from a VM host using
- S> EHLLAPI under Rexx or C. I'm new to this and am using PC/3270 4.0
- S> for OS/2. It seems I can't run the AFTP programs etc ('cos it appears
- S> to need CM/2 DLLs)
-
- From the book, "OS/2 REXX: From Bark to Byte", GG24-4199:
-
- /*EHLSF.CMD */
- /* send OS2.INI , OS2SYS.INI files to host for backup */
-
-
- parse arg session /* host session to work with */
- if session = '' then
- session = 'A'
- /* load hllapi functions */
- if Rxfuncquery('hllapi') then
- call Rxfuncadd 'HLLAPI','SAAHLAPI','HLLAPISRV'
-
- /* connect to session */
- rc= hllapi('Connect',session) /* connect to host session */
- rc= hllapi('Set_session_parms','TIMEOUT=J') /* timeout after 5 minutes */
- /* on send, receive */
- /* check status of VM session */
- rc1= hllapi('Search_PS','VM READ',1)
- rc2= hllapi('Search_PS','RUNNING',1)
-
- /* must disconnect before sending file */
- rc= hllapi('Disconnect')
-
- if (rc1>0 | rc2>0) then /* found VMREAD or RUNNING */
- call SendIniFiles
- else
- say ' host is not in a VM READY or VM RUNNING state. Terminating program.'
-
- return
-
-
-
- /******************************************************/
- /******************************************************/
- SendIniFiles: Procedure Expose session
-
- /* get path of system and user INI files */
- os2ini=VALUE(SYSTEM_INI,,OS2ENVIRONMENT)
- userini=VALUE(USER_INI,,OS2ENVIRONMENT)
-
- /* concatenate host session , filename */
- os2_ini_string=os2ini session||':' 'OS2SYS INI A '
- user_ini_string=userini session||':' 'OS2 INI A '
-
- /* send system INI file to host */
- rc=hllapi('Send_file',os2_ini_string)
- if rc \=3 then
- say 'Error sending file ' os2ini ' to host session ' session||'. RC = ' rc
-
- /* send user INI file to host */
- rc=hllapi('Send_file',user_ini_string)
- if rc \=3 then
- say 'Error sending file ' os2ini ' to host session ' session||'. RC = ' rc
-
- return
-
- S> If you have any such examples which you are willing to show me,
- S> please e-mail them to me directly.
-
- Posted here in case anyone else is interested. Also sent by e-mail.
-
- S> A beer to the first one to help (of course you have to collect it).
-
- Do I win?
-
- S> Simon Bowring
- S> Senior Software Engineer
- S> MPC Data Limited
-
- Dave
- ---
- * KWQ/2 1.2i * Exit, stage right!
-